// JavaScript Document
///// envia parametros a cualqueier destino
function objetoAjax(){
	
        var xmlhttp=false;
        try {
               xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
               try {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
               } catch (E) {
                       xmlhttp = false;
               }
        }
 
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
               xmlhttp = new XMLHttpRequest();

        }

        return xmlhttp;

}


function EnviarForm(_pagina,formid,capa) {

var ajax;
var Formulario = document.getElementById(formid);
var longitudFormulario = Formulario.elements.length;
var cadenaFormulario = "";
var sepCampos;


sepCampos = "";
for (var i=0; i <= Formulario.elements.length-1;i++)
 {
 cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value); 
sepCampos="&"; 
}
 
ajax = objetoAjax();

ajax.open("POST", _pagina, true); 
 
 ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
 
 ajax.onreadystatechange = function() {
	 
if (ajax.readyState==1){ 

 document.getElementById(capa).innerHTML = '<img src="delete.gif" /> ';
 
}

if (ajax.readyState == 4) {
//document.getElementById(capa).value = ajax.responseText;
document.formulario.gato.value = ajax.responseText;
document.formulario.gato2.value = ajax.responseText;

}
}

ajax.send(cadenaFormulario+"&");
}